Skip to content

[Simulation][Gazebo] Gazebo simulation in ROS 2

Hajdu Csaba edited this page Feb 11, 2021 · 2 revisions

Using Gazebo in ROS 2

Setting clock frequency

Gazebo under ROS 2 supports a clock of 10 Hz as of ROS2 Foxy. For most robotic applications this frequency setting is insufficient. Also the tutorials seems to be outdated, works for an earlier version of ROS2.

Fortunately, there is a workaround for this matter. Create a parameter file somewhere on your disk, with the following parameters (set publish rate to 100 Hz):

gazebo:
    ros__parameters:
        publish_rate: 100.0

Start gazebo with the following parameterization:

gazebo world.sdf -s libgazebo_ros_init.so --ros-args --params-file robotlabor-ws/gazebo_params.yaml

So the parameter order: world file and then the ROS2 arguments.

If you check now the /clock topic, you can see

Clone this wiki locally